//utils/system.js

//获取系统信息
const systemInfo = uni.getSystemInfoSync()
//获取状态栏的高度，H5状态栏的高度默认是0
export const getStatusBarHeight = () => systemInfo.statusBarHeight || 0
//获取标题栏高度
export const getTitleBarHeight = () => {
  // 再次获取状态栏的高度
  const statusBarHeight = getStatusBarHeight()
  //判断是否有胶囊按钮
  if (uni.getMenuButtonBoundingClientRect) {
    let { top, height } = uni.getMenuButtonBoundingClientRect()
    return (top - statusBarHeight) * 2 + height
  } else {
    return 40
  }
}

//填充区域
export const getNavBarHeight = () => getStatusBarHeight() + getTitleBarHeight()
